<template>
  <div>
    <MyLayout>
      <el-button type="text" @click="isCreateDialog = true">添加用户</el-button>
      <el-dialog
          title="添加用户"
          :visible.sync="isCreateDialog"
          width="30%"
          :before-close="handleClose">
        <span>
          <create-user @createUserSubmit="cerateUserSubmit"></create-user>
        </span>
        <span slot="footer" class="dialog-footer">
  </span>
      </el-dialog>
    </MyLayout>
  </div>
</template>

<script>
import MyLayout from "@/components/MyLayout";
import CreateUser from "@/components/user/CreateUser";
import {ApiCreateUser} from "../request/api";

export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Index",
  components: {
    MyLayout,
    CreateUser
  },
  data() {
    return {
      isCreateDialog: false
    };
  },
  methods: {
    handleClose() {
      this.isCreateDialog = false;
    },
    cerateUserSubmit(user_form) {
      ApiCreateUser(user_form).then(res => {
        console.log(res)
      })
    }
  }
}
</script>

<style scoped>

</style>